#ifndef __STMFLASH_H
#define __STMFLASH_H

#include "sys.h"


#define STMFLASH_GET_PAGE(a)    (((a)-FLASH_BASE)/FLASH_PAGE_SIZE)
#define STMFLASH_GET_ADDR(p)    ((p)*FLASH_PAGE_SIZE+FLASH_BASE)

extern uint32_t stmflash_read(uint32_t address, uint8_t *buffer, uint32_t size);
extern uint32_t stmflash_write(uint32_t address, uint8_t *buffer, uint32_t size);
extern void stmflash_erase(uint32_t address, uint32_t size);
extern void stmflash_flush(void);
extern int stmflash_init(void);

#endif
